package com.ccxe.io;

import java.io.*;

import org.apache.hadoop.io.*;

/* An entry in the parser's output. */
public final class ParserOutput implements Writable {
	private Data data;

	public ParserOutput() {
	}

	public ParserOutput(Data data) {
		this.data = data;
	}

	public final void readFields(DataInput in) throws IOException {
		this.data = Data.read(in);
//		this.content = in.readBoolean() ? InsertorKey.read(in) : null;
	}

	public final void write(DataOutput out) throws IOException {
		data.write(out);

//		out.writeBoolean(content != null);
//		if (content != null) {
//			content.write(out);
//		}

	}

	public Data getCrawlDatum() {
		return data;
	}

	public boolean equals(Object o) {
		if (!(o instanceof ParserOutput))
			return false;
		ParserOutput other = (ParserOutput) o;
		return this.data.equals(other.data);
	}

	public String toString() {
		StringBuffer buffer = new StringBuffer();
		buffer.append("Data: " + data + "\n");
		return buffer.toString();
	}

}
